package cn.school.test;

import cn.school.dao.SubjectDao;
import cn.school.entity.Subject;
import cn.school.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class SubjectAdd {
    public static void main(String[] args) {
        SqlSession s= MyBatisUtil.get(false);
        Subject sub=new Subject(7L,"航空母舰拆解",100);

        SubjectDao subjectDao = s.getMapper(SubjectDao.class);
        int i = subjectDao.add(sub);
        System.out.println(i);
        System.out.println("新增的id是:"+sub.getId());
        MyBatisUtil.close(s);
    }
}
